package com.yh.ssm.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.struts2.ServletActionContext;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.opensymphony.xwork2.ActionContext;
import com.yh.ssm.dao.ProductMapper;
import com.yh.ssm.service.impl.ProductServiceImpl;

@Component
@Aspect
public class Login {
	
    private static Logger logger = LogManager.getLogger(Login.class);
 /*   ActionContext context = ActionContext.getContext();  
    HttpServletRequest request;  
    HttpServletResponse response;  

	@Before("execution(* com.yh.ssm.service.impl.*Impl.*(..))")*/
	public void before(JoinPoint jp) throws ServletException {
		logger.info("登陆拦截........");
		String name=(String) ServletActionContext.getRequest().getSession().getAttribute("name");
		 
		if(name==null){
			try {
				logger.info("未登陆........");	
				 
	         
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
